#!/usr/bin/env python3
"""COVID-19 Analysis Script
Author: Juan Moises de la Serna
"""
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv('covid_extended.csv')

# CFR by country
cfr = df.groupby('country')['cfr_pct'].mean().sort_values(ascending=False)
print("Mean CFR by country:")
print(cfr)

# Plot deaths over time
for country in ['Brazil', 'Mexico', 'Argentina']:
    sub = df[df['country'] == country]
    plt.plot(sub['year'], sub['deaths'], marker='o', label=country)

plt.title('COVID-19 Deaths by Country')
plt.xlabel('Year')
plt.ylabel('Cumulative Deaths')
plt.legend()
plt.tight_layout()
plt.savefig('covid_deaths.png', dpi=150)
